package com.youtui.manager.common;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;

/**
 * 全局日期处理类
 * Convert<T,S>
 *         泛型T:代表客户端提交的参数 String
 *         泛型S:通过convert转换的类型
   
 */
public class DateConvert implements WebBindingInitializer  {

	@Override
	public void initBinder(WebDataBinder binder, WebRequest request) {    
        
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");    
        binder.registerCustomEditor(Date.class, new CustomDateEditor(df, false));    
    } 
}